/**
 * 更新页码
 */
function showPage(pageTemp, recordsLength, totalRecords){
    var totalPage = totalRecords%recordsLength > 0 && parseInt(totalRecords/recordsLength) + 1 || totalRecords/recordsLength;
	if(totalPage==0){
		$("#pagePan").hide();
	}else{
		$("#pagePan").show();
	}
	/*if(totalPage==pageTemp){
		//$("#next").unbind("click");
        $("#previous").one("click", function () {
            previous();
        });
	}else if(pageTemp==1){
        //$("#previous").unbind("click");
		$("#next").one("click", function () {
            next();
        });
	} else {
        $("#previous").unbind("click");
        $("#next").unbind("click");
        $("#previous").one("click", function () {
            previous();
        });
        $("#next").one("click", function () {
            next();
        });
    }*/

	if(totalPage>0){
		var html = '<a id="first" class="first paginate_button" pageNum="1">首页</a>';
		var endHtml = '<a class="last paginate_button" pageNum="'+totalPage+'" id="last">末页</a>';
		var start = pageTemp-2;
		var end = pageTemp+2;
		if(start<1){
			start = 1;
            end += 2;
		}
		if(end>totalPage){
			end = totalPage;
            if (start > 1) {
                start -= 2;
            }
		}
        if(start<1){
            start = 1;
        }
		for(var i=start;i<=end;i++){
			if(i==pageTemp){
				html += '<a pageNum="'+i+'" class="paginate_active">'+i+'</a>';
			}else{
                html += '<a pageNum="'+i+'" class="paginate_button">'+i+'</a>';
			}
		}
		html += endHtml;
		$("#pageNumber").html("");
		$("#pageNumber").append(html);
	}
    var recordBegin = (pageTemp - 1) * recordsLength + 1;
    var recordEnd;
    if (totalRecords - recordBegin < recordsLength) {
        recordEnd = totalRecords;
    } else {
        recordEnd = recordBegin + recordsLength -1;
    }
	$("#total").html(" 当前显&nbsp;示&nbsp;"+recordBegin+"到&nbsp;"+recordEnd+"&nbsp;&nbsp; 共 "+totalRecords+" 个条目 "+totalPage+" 页");
}


